<template>
  <el-dialog
    title="创建需求分类"
    :visible.sync="dialogVisible"
    :modal-append-to-body="false"
    :before-close="handleClose"
    width="40%"
  >
    <el-form :model="form">
      <el-form-item label="分类名称" :label-width="formLabelWidth">
        <el-input v-model="form.name" placeholder="请填写分类名称" autocomplete="off" />
      </el-form-item>
      <el-form-item label="分类描述" :label-width="formLabelWidth">
        <el-input v-model="form.desc" type="textarea" :rows="2" placeholder="请输入分类描述" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="handleClose">取 消</el-button>
      <el-button type="primary" @click="dialogVisibleNeed = false">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'NeedTypeCreate',
  props: {
    dialogVisibleNeed: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      form: {
        name: '',
        desc: '',
      },
      formLabelWidth: '120px',
      dialogVisible: this.dialogVisibleNeed
    };
  },
  watch: {
    dialogVisibleNeed(val) {
      this.dialogVisible = val;
    },
  },
  methods: {
    handleClose(done) {
      done();
      this.$emit('closeDialog');
    },
  },
};
</script>

<style>
</style>
